<?php
    include('../Lib/php/conex.php');
	$link= conectaSQL("influenza","inf123456","influenza");
import_request_variables('gP');

$cadena = trim($value);

if($parametro != 1) {
	$sql="select TOP 10 id_principal,(cPaterno+' '+cMaterno+' '+cNombre+' (curp:'+Curp+')') as 'nombre' 
		from dat_generales a
		WHERE cPaterno+' '+cMaterno+' '+cNombre LIKE upper('%".$cadena."%')
 		group by id_principal,cPaterno+' '+cMaterno+' '+cNombre,Curp
		order by cPaterno+' '+cMaterno+' '+cNombre";
}else{
	$sql="select TOP 10 id_principal,(cPaterno+' '+cMaterno+' '+cNombre+' (curp:'+Curp+')') as 'nombre' 
		from dat_generales a
		INNER JOIN dat_registro b ON (a.id_principal = b.id_generales)
		WHERE cPaterno+' '+cMaterno+' '+cNombre LIKE upper('%".$cadena."%')
		AND b.id_unidad = ".$_SESSION['idunidad']."
 		group by id_principal,cPaterno+' '+cMaterno+' '+cNombre,Curp
		order by cPaterno+' '+cMaterno+' '+cNombre";

}

$query = mssql_query($sql,$link);
$registros = mssql_num_rows($query);
echo "<ul class='datos' >";
	if($registros == 0){
		echo "<li style='visibility:collapse'>No hay resultados</li>";
	} else{
	
		//echo "<select name='resultado' class='datos' size=$registros>";
		for($a=0;$a<$registros;$a++){
			$reg = mssql_fetch_array($query);
			echo "<li>".$reg[1]."</li>";
		}
		//echo "</select>";
	}
echo "</ul>";

//			onClick=\"Javascript:document.getElementById('id_unid').value=this.value\"; 
?>

